/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package es.plg.analex.utils;

import java.awt.Component;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.border.Border;

/**
 *
 * @author hp
 */
public class PintaFondo implements Border {
    private BufferedImage back;
 
    public PintaFondo() throws MalformedURLException, IOException{
            URL imagePath = new URL(getClass().getResource("/es/plg/analex/resources/images/Fondo_pantalla.jpg").toString());
            setBack(ImageIO.read(imagePath));
    }
 
    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
        g.drawImage(getBack(),0,0,c.getWidth(),c.getHeight(), null);
    }
 
    public Insets getBorderInsets(Component c) {
        return new Insets(0,0,0,0);
    }
 
    public boolean isBorderOpaque() {
        return false;
    }

    /**
     * @return the back
     */
    public BufferedImage getBack() {
        return back;
    }

    /**
     * @param back the back to set
     */
    public final void setBack(BufferedImage back) {
        this.back = back;
    }
 
}
    
